From c60a6821d3a809cb46825d19e38b3dbbf63d3f4d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 4 Aug 2004 05:06:59 +0000 Subject: [PATCH] Fix #133446, noticed by Christian Persch: Wed Aug 4 01:04:48 2004 Matthias Clasen Fix #133446, noticed by Christian Persch: * gtk/gtkaction.c (gtk_action_class_init): Add a new boolean property ::visible-overflown. * gtk/gtkaction.c (gtk_action_create_menu_proxy): Don't create a menu proxy if visible_overflown is FALSE. --- ChangeLog | 9 ++++++ ChangeLog.pre-2-10 | 9 ++++++ ChangeLog.pre-2-6 | 9 ++++++ ChangeLog.pre-2-8 | 9 ++++++ gtk/gtkaction.c | 74 +++++++++++++++++++++++++++++++++++----------- 5 files changed, 93 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8228b1b597..6fec678b1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Aug 4 01:04:48 2004 Matthias Clasen + + Fix #133446, noticed by Christian Persch: + + * gtk/gtkaction.c (gtk_action_class_init): Add a new boolean + property ::visible-overflown. + * gtk/gtkaction.c (gtk_action_create_menu_proxy): Don't create + a menu proxy if visible_overflown is FALSE. + Tue Aug 3 20:16:26 2004 Matthias Clasen * gtk/gtkactiongroup.[hc]: Make the the GtkAction{Toggle,Radio,}Entry* diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8228b1b597..6fec678b1c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Wed Aug 4 01:04:48 2004 Matthias Clasen + + Fix #133446, noticed by Christian Persch: + + * gtk/gtkaction.c (gtk_action_class_init): Add a new boolean + property ::visible-overflown. + * gtk/gtkaction.c (gtk_action_create_menu_proxy): Don't create + a menu proxy if visible_overflown is FALSE. + Tue Aug 3 20:16:26 2004 Matthias Clasen * gtk/gtkactiongroup.[hc]: Make the the GtkAction{Toggle,Radio,}Entry* diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8228b1b597..6fec678b1c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Wed Aug 4 01:04:48 2004 Matthias Clasen + + Fix #133446, noticed by Christian Persch: + + * gtk/gtkaction.c (gtk_action_class_init): Add a new boolean + property ::visible-overflown. + * gtk/gtkaction.c (gtk_action_create_menu_proxy): Don't create + a menu proxy if visible_overflown is FALSE. + Tue Aug 3 20:16:26 2004 Matthias Clasen * gtk/gtkactiongroup.[hc]: Make the the GtkAction{Toggle,Radio,}Entry* diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8228b1b597..6fec678b1c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Wed Aug 4 01:04:48 2004 Matthias Clasen + + Fix #133446, noticed by Christian Persch: + + * gtk/gtkaction.c (gtk_action_class_init): Add a new boolean + property ::visible-overflown. + * gtk/gtkaction.c (gtk_action_create_menu_proxy): Don't create + a menu proxy if visible_overflown is FALSE. + Tue Aug 3 20:16:26 2004 Matthias Clasen * gtk/gtkactiongroup.[hc]: Make the the GtkAction{Toggle,Radio,}Entry* diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index 0bdc4b811c..deeeffb198 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -56,14 +56,15 @@ struct _GtkActionPrivate gchar *tooltip; gchar *stock_id; /* icon */ - guint sensitive : 1; - guint visible : 1; - guint label_set : 1; /* these two used so we can set label */ - guint short_label_set : 1; /* based on stock id */ + guint sensitive : 1; + guint visible : 1; + guint label_set : 1; /* these two used so we can set label */ + guint short_label_set : 1; /* based on stock id */ guint visible_horizontal : 1; guint visible_vertical : 1; - guint is_important : 1; - guint hide_if_empty : 1; + guint is_important : 1; + guint hide_if_empty : 1; + guint visible_overflown : 1; /* accelerator */ guint accel_count; @@ -93,6 +94,7 @@ enum PROP_STOCK_ID, PROP_VISIBLE_HORIZONTAL, PROP_VISIBLE_VERTICAL, + PROP_VISIBLE_OVERFLOWN, PROP_IS_IMPORTANT, PROP_HIDE_IF_EMPTY, PROP_SENSITIVE, @@ -199,7 +201,8 @@ gtk_action_class_init (GtkActionClass *klass) PROP_LABEL, g_param_spec_string ("label", P_("Label"), - P_("The label used for menu items and buttons that activate this action."), + P_("The label used for menu items and buttons " + "that activate this action."), NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, @@ -220,28 +223,49 @@ gtk_action_class_init (GtkActionClass *klass) PROP_STOCK_ID, g_param_spec_string ("stock_id", P_("Stock Icon"), - P_("The stock icon displayed in widgets representing this action."), + P_("The stock icon displayed in widgets representing " + "this action."), NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VISIBLE_HORIZONTAL, g_param_spec_boolean ("visible_horizontal", P_("Visible when horizontal"), - P_("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."), + P_("Whether the toolbar item is visible when the toolbar " + "is in a horizontal orientation."), + TRUE, + G_PARAM_READWRITE)); + /** + * GtkAction:visible-overflown: + * + * When %TRUE, toolitem proxies for this action are represented in the + * toolbar overflow menu. + * + * Since: 2.6 + */ + g_object_class_install_property (gobject_class, + PROP_VISIBLE_OVERFLOWN, + g_param_spec_boolean ("visible_overflown", + P_("Visible when overflown"), + P_("When TRUE, toolitem proxies for this action " + "are represented in the toolbar overflow menu."), TRUE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VISIBLE_VERTICAL, g_param_spec_boolean ("visible_vertical", P_("Visible when vertical"), - P_("Whether the toolbar item is visible when the toolbar is in a vertical orientation."), + P_("Whether the toolbar item is visible when the toolbar " + "is in a vertical orientation."), TRUE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_IS_IMPORTANT, g_param_spec_boolean ("is_important", P_("Is important"), - P_("Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode."), + P_("Whether the action is considered important. " + "When TRUE, toolitem proxies for this action " + "show text in GTK_TOOLBAR_BOTH_HORIZ mode."), FALSE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, @@ -305,6 +329,7 @@ gtk_action_init (GtkAction *action) action->private_data->stock_id = NULL; action->private_data->visible_horizontal = TRUE; action->private_data->visible_vertical = TRUE; + action->private_data->visible_overflown = TRUE; action->private_data->is_important = FALSE; action->private_data->hide_if_empty = TRUE; @@ -467,6 +492,9 @@ gtk_action_set_property (GObject *object, case PROP_VISIBLE_VERTICAL: action->private_data->visible_vertical = g_value_get_boolean (value); break; + case PROP_VISIBLE_OVERFLOWN: + action->private_data->visible_overflown = g_value_get_boolean (value); + break; case PROP_IS_IMPORTANT: action->private_data->is_important = g_value_get_boolean (value); break; @@ -521,6 +549,9 @@ gtk_action_get_property (GObject *object, case PROP_VISIBLE_VERTICAL: g_value_set_boolean (value, action->private_data->visible_vertical); break; + case PROP_VISIBLE_OVERFLOWN: + g_value_set_boolean (value, action->private_data->visible_overflown); + break; case PROP_IS_IMPORTANT: g_value_set_boolean (value, action->private_data->is_important); break; @@ -726,13 +757,22 @@ static gboolean gtk_action_create_menu_proxy (GtkToolItem *tool_item, GtkAction *action) { - GtkWidget *menu_item = gtk_action_create_menu_item (action); - - g_object_ref (menu_item); - gtk_object_sink (GTK_OBJECT (menu_item)); + GtkWidget *menu_item; - gtk_tool_item_set_proxy_menu_item (tool_item, "gtk-action-menu-item", menu_item); - g_object_unref (menu_item); + if (action->private_data->visible_overflown) + { + menu_item = gtk_action_create_menu_item (action); + + g_object_ref (menu_item); + gtk_object_sink (GTK_OBJECT (menu_item)); + + gtk_tool_item_set_proxy_menu_item (tool_item, + "gtk-action-menu-item", menu_item); + g_object_unref (menu_item); + } + else + gtk_tool_item_set_proxy_menu_item (tool_item, + "gtk-action-menu-item", NULL); return TRUE; } -- 2.30.2